--[[
    * Author:Dzlua
    * QQ:505544956
    * time:2016/06/27
--]]

set_project("edui")

-- version
set_version("1.0.0")

-- set warning all as error
set_warnings("all", "error")
add_cxflags("-Wno-delete-non-virtual-dtor")
add_cxflags("-EHsc")

-- set language: c99, c++11
set_languages("c99", "cxx11")

-- add defines to config.h
add_defines_h("$(prefix)_OS_$(os:upper)")

-- the debug mode
if is_mode("debug") then

    -- enable the debug symbols
    set_symbols("debug")

    -- disable optimization
    set_optimize("none")
end

-- the release or profile is_mode
if is_mode("release", "profile") then

    -- the release mode
    if is_mode("release") then

        -- set the symbols visibility: hidden
        set_symbols("hidden")

        -- strip all symbols
        set_strip("all")

    -- the profile mode
    else

        -- enable the debug symbols
        set_symbols("debug")

    end

    -- for pc
    if is_arch("i386", "x86_64") then

        -- enable fastest optimization
        set_optimize("fastest")

    -- for embed
    else
        -- enable smallest optimization
        set_optimize("smallest")
    end
end

-- for embed
if not is_arch("i386", "x86_64") then

    -- add defines to config.h
    add_defines_h("$(prefix)_SMALL")
end

-- for the windows platform (msvc)
if is_plat("windows") then

    -- the release mode
    if is_mode("release") then

        -- link libcmt.lib
        add_cxflags("-MT")

    -- the debug mode
    elseif is_mode("debug") then

        -- enable some checkers
        add_cxflags("-Gs", "-RTC1")

        -- link libcmtd.lib
        add_cxflags("-MTd")
    end

    -- no msvcrt.lib
    add_ldflags("-nodefaultlib:\"msvcrt.lib\"")
end

if is_mode("debug") then
    add_defines("DEBUG")
else
    add_defines("NDEBUG")
end

add_defines_h("EDUI_MAX_PATH=260")
add_defines_h("EDUI_EVENT_LISTENER_MAXNUM=1")
add_defines("SDL_MAIN_HANDLED")

-- options
option("use-lua")
    set_default(true)
    set_showmenu(true)
    set_description("Enable or disable use lua")
option("test-new-delete")
    set_default(false)
    set_showmenu(true)
    set_description("Enable or disable the test new delete")
option("test-mouse-control")
    set_default(false)
    set_showmenu(true)
    set_description("Enable or disable the test mouse control")
    
-- add packages
add_packagedirs("pkg")

--edui
add_subdirs("edui_sdl")
--tools
add_subdirs("tools")
--test
add_subdirs("test")
